package com.application.outdoor.InvoikeServices;

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import android.util.Log;

import com.application.Network.Protocol;

public class CommonInvoike extends BaseInvoike {
	
	final static String TAG=Protocol.TAG;
	public CommonInvoike(){
		super();
		url+="/CommonServlet";;
	}
	public  void vaoNhomThaoLuan(String nguoiGui, String nguoiNhan) throws Exception{
		ArrayList<NameValuePair> params=new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.GUI_TIN_NHAN));
		params.add(new BasicNameValuePair(Protocol.MSG_TYPE, Protocol.JOIN_GROUP));
		params.add(new BasicNameValuePair(Protocol.NGUOI_GUI, nguoiGui+""));
		params.add(new BasicNameValuePair(Protocol.NOI_DUNG, "ko"));
		params.add(new BasicNameValuePair(Protocol.NGUOI_NHAN, nguoiNhan+""));
		post(url, params);
		Log.d(TAG,"CommonInvoike.vaoNhomThaoLuan n.gui="+nguoiGui+ " n.nhan="+nguoiNhan);
	}
	public  void guiTinNhan(String nguoiGui,String nguoiNhan,String noiDung,String msgType) throws Exception{
		ArrayList<NameValuePair> params=new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.GUI_TIN_NHAN));
		params.add(new BasicNameValuePair(Protocol.MSG_TYPE, msgType));
		params.add(new BasicNameValuePair(Protocol.NGUOI_GUI, nguoiGui));
		params.add(new BasicNameValuePair(Protocol.NOI_DUNG, noiDung));
		params.add(new BasicNameValuePair(Protocol.NGUOI_NHAN, nguoiNhan+""));
		post(url, params);
	}
	public  String taoNhom(String nguoiTao, String tenNhom) throws Exception {
		ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.TAO_NHOM));
		params.add(new BasicNameValuePair(Protocol.NGUOI_DUNG, nguoiTao));
		params.add(new BasicNameValuePair(Protocol.NOI_DUNG, tenNhom));
		String rs = post(url, params);
		return rs;
	}
	public  String getContact(int idNhom) throws Exception {
		ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.LAY_DANH_SACH_THANH_VIEN));
		params.add(new BasicNameValuePair(Protocol.ID_NHOM, idNhom+""));
		String rs = post(url, params);
		return rs;
	}
	public  String getSubject(int idNhom) throws Exception{
		ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.LAY_CAY_THEO_NHOM));
		params.add(new BasicNameValuePair(Protocol.ID_NHOM, idNhom+""));
		String rs = post(url, params);
		return rs;
	}
	public String getFileCuaNhom(int idNhom) throws Exception{
		ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.FILE_CUA_NHOM));
		params.add(new BasicNameValuePair(Protocol.ID_NHOM, idNhom+""));
		String rs = post(url, params);
		return rs;
	}
}
